#include<bits/stdc++.h>
using namespace std;
const int NN=2e5+4;
int a[NN];
int main()
{
	freopen("clear.in","r",stdin);
	freopen("clear.out","w",stdout);
	int n,m,Q;
	scanf("%d%d%d",&n,&m,&Q);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	while(Q--)
	{
		int l,r;
		scanf("%d%d",&l,&r);
		deque<pair<int,int> >q;
		int res=0;
		long long ans=0;
		for(int i=l;i<=r;i++)
		{
			while(q.size()&&q.front().first<=i-m)
			{
				res-=q.front().second;
				q.pop_front();
			}
			while(res>a[i])
			{
				pair<int,int>t=q.front();
				q.pop_front();
				int w=min(t.second,res-a[i]);
				res-=w,t.second-=w;
				if(t.second)
					q.push_front(t);
			}
			if(res<a[i])
			{
				q.push_back({i,a[i]-res});
				ans+=a[i]-res;
				res=a[i];
			}
		}
		printf("%lld\n",ans);
	}
	return 0;
}
